import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_li_ke_jie/style/common_color.dart';

class SubmitButton extends StatefulWidget {
  final String text;
  final VoidCallback? clickCallback;
  final bool isEnabled;
  const SubmitButton(this.text,{Key? key,this.clickCallback,this.isEnabled=true}) : super(key: key);

  @override
  _SubmitButtonState createState() => _SubmitButtonState();
}

class _SubmitButtonState extends State<SubmitButton> {
  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 50,
      child: MaterialButton(
        color: widget.isEnabled?themeColor:Colors.grey[100],
        child: Text(widget.text,style: TextStyle(fontSize: 18,fontWeight: FontWeight.bold,color: widget.isEnabled?Colors.white:Colors.grey[400]),),
        shape: const RoundedRectangleBorder(
          borderRadius: BorderRadius.all(Radius.circular(25))
        ),
        onPressed: (){
          widget.clickCallback!();
        },
      ),
    );
  }
}

